package com.wht.bill.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wht.bill.R;
import com.wht.bill.bean.BillBean;


/**
 * 账户列表适配器
 */
public class ClassifyRankAdapter extends BaseQuickAdapter<BillBean, BaseViewHolder> {


    public ClassifyRankAdapter() {
        super(R.layout.item_tallytype_rank);
    }


    @Override
    protected void convert(BaseViewHolder helper, BillBean item) {
        TextView tvTitle = helper.getView(R.id.title);
        TextView tvMoney = helper.getView(R.id.money);
        if (item != null) {
            if (!TextUtils.isEmpty(item.classification)) {
                tvTitle.setText(item.classification+"("+item.time+")");
            } else {
                tvTitle.setText("");
            }
            if (!TextUtils.isEmpty(item.money)) {
                String perStr = TextUtils.equals("1", item.billType) ? "-" : "+";
                tvMoney.setText(String.format("%s%s", perStr, item.money));
            } else {
                tvMoney.setText("");
            }

        }
    }
}
